You must fill in a sound double buffer header record and two sound double buffer records if you wish to manage your own double buffers. The SndDoubleBufferHeader data type defines a sound double buffer header.
TYPE SndDoubleBufferHeader =
PACKED RECORD
dbhNumChannels: Integer; {number of sound channels}
dbhSampleSize: Integer; {sample size, if noncompressed}
dbhCompressionID: Integer; {ID of compression algorithm}
dbhPacketSize: Integer; {number of bits per packet}
dbhSampleRate: Fixed; {sample rate}
dbhBufferPtr: ARRAY[0..1] OF SndDoubleBufferPtr;
{pointers to SndDoubleBuffer}
dbhDoubleBack: ProcPtr; {pointer to doubleback procedure}
END;
Sound Manager versions 3.0 and later support custom compression and decompression algorithms by defining the revised sound double buffer header record, of type SndDoubleBufferHeader2 . It's identical to the SndDoubleBufferHeader data type except that it contains the dbhFormat field at the end.
TYPE SndDoubleBufferHeader2 =
PACKED RECORD
dbhNumChannels: Integer; {number of sound channels}
dbhSampleSize: Integer; {sample size, if noncompressed}
dbhCompressionID: Integer; {ID of compression algorithm}
dbhPacketSize: Integer; {number of bits per packet}
dbhSampleRate: Fixed; {sample rate}
dbhBufferPtr: ARRAY[0..1] OF SndDoubleBufferPtr;
{pointers to SndDoubleBuffer}
dbhDoubleBack: ProcPtr; {pointer to doubleback procedure}
dbhFormat: OSType; {signature of codec}
END;
The dbhBufferPtr array contains pointers to two sound double buffer records, whose format is defined below. These are the two buffers between which the Sound Manager switches until all the sound data has been sent into the sound channel. When you make the call to SndPlayDoubleBuffer , the two buffers should both already contain a nonzero number of frames of data.
| Previous | Chapter contents | Chapter top | Section top | Next |